package online.controller;

import io.swagger.v3.oas.annotations.Parameter;
import online.entity.UserDao;
import online.service.LoginService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/redis/")
public class RedisController {

    @Autowired
    private LoginService loginService;

    @GetMapping("/list")
    public Object list(){
        return loginService.getAllUser();
    }

    @GetMapping("/get/{id}")
    public Object getRedis(@PathVariable Long id) {
        return loginService.getById(id);
    }

    @PostMapping("/set")
    public Object setRedis(@Parameter UserDao userDao) {
        return loginService.save(userDao);
    }

}
